import asyncio
from fastmcp import Client   # 同一包自带客户端

async def main():
    # 1. 指向刚才启动的服务端
    client = Client("http://127.0.0.1:9000/mcp")

    async with client:
        # 2. 调用工具
        r1 = await client.call_tool("greet", {"name": "world"})
        r2 = await client.call_tool("calculate", {"a": 12, "b": 15, "op": "*"})

        # 3. 打印结果
        print("greet ->", r1.content[0].text)
        print("calculate 12*15 ->", r2.content[0].text)

if __name__ == "__main__":
    asyncio.run(main())